<template>
  <el-dialog :title="title" v-model="dialogVisible" size="tiny" @close="close">
    <span>
      <slot></slot>
    </span>
  </el-dialog>
</template>
<script>
  import {mapState} from 'vuex'
  import * as types from '../store/mutations-type'
  export default {
    props: ['title', 'moduleName'],
    computed: {
      ...mapState({
        dialogVisible: state => {
          return state[state.home.moduleName].dialogVisible
        }
      })
    },
    methods: {
      close () {
        this.$store.dispatch(types[this.moduleName.toUpperCase() + '_CLOSE_FORM'])
      }
    }
  }
</script>
<style>
  .el-dialog--tiny {
    min-width: 525px;
    width: inherit !important;
  }
</style>
